


import '../main.dart';

String? analysisBookNoRule(String epc){
  String rule = settingEntity.analysisBook??'xy';
  String? result = '';
  if(rule == 'xy'){
    result = xyRule(epc);
  }
  if(rule == 'xm'){
    result = xmRule(epc);
  }
  return result;
}

String? xyRule(String epc){
  int? len = int.tryParse(epc.substring(0,2));
  if(len != null && epc.length>len+2){
    var no = epc.substring(2,len+2);
    return no;
  }
  return null;
}

String? xmRule(String epc){
  if(epc.startsWith('FFFF')){
    return 'J43G124${epc.substring(4,11)}';
  }
  return null;
}
